package com.m8n6.demo2.controller.admin;

import com.m8n6.demo2.common.http.ResponseResult;
import com.m8n6.demo2.common.security.anno.AuthIgnore;
import com.m8n6.demo2.entity.AUserEntity;
import com.m8n6.demo2.service.admin.AUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Admin User Controller
 *
 * @author m8n6
 */
@RestController
@RequestMapping("/api/admin/")

public class AUserController {
    // TODO
@Autowired
private AUserService aUserService;
    @RequestMapping("/user")
    public String user() {
        return "user";
    }

    @AuthIgnore
    @PostMapping("/login")
    public ResponseResult<Map<String, String>> login(@RequestBody AUserEntity aUserEntity) {
        System.out.println(aUserEntity);
        return aUserService.login(aUserEntity);
    }
}
